package com.tstudy.laoshibang.mode;

import com.google.gson.Gson;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import android.text.TextUtils;


/**
 *User model类
* @CopyRight xinweitech.cn
* @author wuyahui
* @E-mail wuyahui0124505@163.com
* @version 1.0.0
* @Date 2015年6月3日 上午11:27:02
 */
@DatabaseTable
public class User implements BaseModel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6079788363862247150L;
	@DatabaseField(id=true)
	public String userNo;
	@DatabaseField
	public String mobile;
	@DatabaseField
	public String password;
	@DatabaseField
	public int mediaSource;
	@DatabaseField
	public int role;
	
	public String validateNo;
	@DatabaseField
	public String equipId;
	public int isSameUser;
	
	//第三方登录信息
	@DatabaseField
	public int source;
	@DatabaseField
	public String sourceId;
	
	@DatabaseField
	public int isLogin;//是否登陆状态
	
	@DatabaseField
	public String nick;
	
	@DatabaseField
	public String birthday;
	
	@DatabaseField
	public String sign;
	
	@DatabaseField
	public int scoreNum;//	积分数量
	@DatabaseField
	public int sysMesUReadNum;//	系统消息未读数量
	@DatabaseField
	public int tcMesUReadNum;//	吐槽消息未读数量

	@DatabaseField
	public String userName;
	@DatabaseField
	public String email;
	
	@DatabaseField
	public String imgIdxName;
	

	@DatabaseField
	public String toInvitateCode;
	
	@DatabaseField
	public String provinceStr;
	public DicMap province;
	@DatabaseField
	public String cityStr;
	public DicMap city;
	@DatabaseField
	public String countyStr;
	public DicMap county;
	@DatabaseField
	public String sexStr;
	public DicMap sex;
	@DatabaseField
	public String levelStr;
	public DicMap level;
	@DatabaseField
	public String schoolStr;
	public DicMap school;
	
	
	public DicMap parseDicMap(String str){
		return new Gson().fromJson(str,DicMap.class);
	}
	
	public void parseAllDicMap(){
		if (!TextUtils.isEmpty(schoolStr)) {
			school = new Gson().fromJson(schoolStr,DicMap.class);
		}
		if (!TextUtils.isEmpty(provinceStr)) {
			province = new Gson().fromJson(provinceStr,DicMap.class);
		}
		if (!TextUtils.isEmpty(cityStr)) {
			city = new Gson().fromJson(cityStr,DicMap.class);
		}
		if (!TextUtils.isEmpty(countyStr)) {
			county = new Gson().fromJson(countyStr,DicMap.class);
		}
		if (!TextUtils.isEmpty(levelStr)) {
			level = new Gson().fromJson(levelStr,DicMap.class);
		}
		if (!TextUtils.isEmpty(sexStr)) {
			sex = new Gson().fromJson(sexStr,DicMap.class);
		}
	}
	
	public void allDicStr(){
		if (school != null) {
			schoolStr = new Gson().toJson(school);
		}
		if (province != null) {
			provinceStr = new Gson().toJson(province);
		}
		if (city != null) {
			cityStr = new Gson().toJson(city);
		}
		if (county != null) {
			countyStr = new Gson().toJson(county);
		}
		if (sex != null) {
			sexStr = new Gson().toJson(sex);;
		}
		if (level != null) {
			levelStr = new Gson().toJson(level);
		}
	}
	
	

	public User(){
		super(); 
	}

	public String getUserNo() {
		return userNo;
	}

	public String getMobile() {
		return mobile;
	}

	public String getPassword() {
		return password;
	}

	public int getMediaSource() {
		return mediaSource;
	}

	public int getRole() {
		return role;
	}

	public String getValidateNo() {
		return validateNo;
	}

	public String getEquipId() {
		return equipId;
	}

	public int getSource() {
		return source;
	}

	public String getSourceId() {
		return sourceId;
	}

	public int isLogin() {
		return isLogin;
	}

	public String getNick() {
		return nick;
	}

	public String getImgIdxName() {
		return imgIdxName;
	}

	public String getToInvitateCode() {
		return toInvitateCode;
	}

	public String getProvinceStr() {
		return provinceStr;
	}

	public String getCityStr() {
		return cityStr;
	}

	public String getCountyStr() {
		return countyStr;
	}

	public String getSexStr() {
		return sexStr;
	}

	public String getLevelStr() {
		return levelStr;
	}

	public String getSchoolStr() {
		return schoolStr;
	}

	public void setUserNo(String userNo) {
		this.userNo = userNo;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setMediaSource(int mediaSource) {
		this.mediaSource = mediaSource;
	}

	public void setRole(int role) {
		this.role = role;
	}

	public void setValidateNo(String validateNo) {
		this.validateNo = validateNo;
	}

	public void setEquipId(String equipId) {
		this.equipId = equipId;
	}

	public void setSource(int source) {
		this.source = source;
	}

	public void setSourceId(String sourceId) {
		this.sourceId = sourceId;
	}

	public void setLogin(int isLogin) {
		this.isLogin = isLogin;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}

	public void setImgIdxName(String imgIdxName) {
		this.imgIdxName = imgIdxName;
	}

	public void setToInvitateCode(String toInvitateCode) {
		this.toInvitateCode = toInvitateCode;
	}

	public void setProvinceStr(String provinceStr) {
		this.provinceStr = provinceStr;
	}

	public void setCityStr(String cityStr) {
		this.cityStr = cityStr;
	}

	public void setCountyStr(String countyStr) {
		this.countyStr = countyStr;
	}

	public void setSexStr(String sexStr) {
		this.sexStr = sexStr;
	}

	public void setLevelStr(String levelStr) {
		this.levelStr = levelStr;
	}

	public void setSchoolStr(String schoolStr) {
		this.schoolStr = schoolStr;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public int getScoreNum() {
		return scoreNum;
	}

	public void setScoreNum(int scoreNum) {
		this.scoreNum = scoreNum;
	}

	public int getSysMesUReadNum() {
		return sysMesUReadNum;
	}

	public void setSysMesUReadNum(int sysMesUReadNum) {
		this.sysMesUReadNum = sysMesUReadNum;
	}

	public int getTcMesUReadNum() {
		return tcMesUReadNum;
	}

	public void setTcMesUReadNum(int tcMesUReadNum) {
		this.tcMesUReadNum = tcMesUReadNum;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public DicMap getProvince() {
		return province;
	}

	public void setProvince(DicMap province) {
		this.province = province;
	}

	public DicMap getCity() {
		return city;
	}

	public void setCity(DicMap city) {
		this.city = city;
	}

	public DicMap getCounty() {
		return county;
	}

	public void setCounty(DicMap county) {
		this.county = county;
	}

	public DicMap getSex() {
		return sex;
	}

	public void setSex(DicMap sex) {
		this.sex = sex;
	}

	public DicMap getLevel() {
		return level;
	}

	public void setLevel(DicMap level) {
		this.level = level;
	}

	public DicMap getSchool() {
		return school;
	}

	public void setSchool(DicMap school) {
		this.school = school;
	}

	
}
